<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no"/>
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<title>AutoCode</title>
<link rel="shortcut icon" href="/favicon.ico" />
<script src="/links/jquery/jquery-3.5.1.min.js"></script>
<script src="/links/polyfill.min.js"></script>
<script src="/links/axios/axios.min.js"></script>
<script src="/links/vue/vue.min.js"></script>
<script src="/links/element-ui/index.js"></script>
<script src="/links/dayjs.min.js"></script>
<script src="/links/echarts/echarts.js"></script>
<script src="/links/JsBarcode.all.js"></script>
<script src="/links/qrcode.min.js"></script>
<script src="/links/layer/layer.js"></script>
<script src="/links/crypto/crypto-js.js"></script>
<script src="/js/dragController.js"></script>
<script src="/js/HttpApi.js"></script>
<script src="/js/AutoCode.js"></script>
<link href="/links/element-ui/theme/index.css" rel="stylesheet"/>
<link href="/css/default.css" rel="stylesheet"/>
<link href="/css/dragController.css" rel="stylesheet"/>
<script src="/links/ace/src/ace.js"></script>
<script src="/links/ace/src/ext-language_tools.js"></script>
<script src="/links/beautify/beautify.min.js"></script>
<script src="/links/beautify/beautify-css.min.js"></script>
<script src="/links/beautify/beautify-html.min.js"></script>
    <style>
        
    </style>
</head>
<body>
<div id="app"  class="box " >
<div class="topBox " style="height:300px;">
<div class="flex ac-table-head">
    <div class="ac-table-oper"><el-form :inline="true" :model="excelTemplate.operData" size="mini" class="searchForm" @submit.native.prevent="excelTemplate_load">
<el-form-item v-if="excelTemplate.operVisible.buttonA==undefined || excelTemplate.operVisible.buttonA"><el-button size="medium"  v-if="excelTemplate.operVisible.buttonA==undefined || excelTemplate.operVisible.buttonA" @click="excelTemplate_openExcelTemplateAdd()" :disabled="excelTemplate.operDisabled.buttonA"  type="text"     native-type="button">添加(A)</el-button>
</el-form-item>
<el-form-item v-if="excelTemplate.operVisible.buttonD==undefined || excelTemplate.operVisible.buttonD"><el-button size="medium"  v-if="excelTemplate.operVisible.buttonD==undefined || excelTemplate.operVisible.buttonD" @click="excelTemplate_delete()" :disabled="excelTemplate.operDisabled.buttonD"  type="text"     native-type="button">删除(D)</el-button>
</el-form-item>
<el-form-item v-if="excelTemplate.operVisible.buttonE==undefined || excelTemplate.operVisible.buttonE"><el-button size="medium"  v-if="excelTemplate.operVisible.buttonE==undefined || excelTemplate.operVisible.buttonE" @click="excelTemplate_editExcelTemplateAdd()" :disabled="excelTemplate.operDisabled.buttonE"  type="text"     native-type="button">编辑(E)</el-button>
</el-form-item>
<el-form-item v-if="excelTemplate.operVisible.buttonQ==undefined || excelTemplate.operVisible.buttonQ"><el-button size="medium"  v-if="excelTemplate.operVisible.buttonQ==undefined || excelTemplate.operVisible.buttonQ" @click="excelTemplate_load()" :disabled="excelTemplate.operDisabled.buttonQ"  type="text"     native-type="button">刷新(Q)</el-button>
</el-form-item>
<el-form-item v-if="excelTemplate.operVisible.buttonC==undefined || excelTemplate.operVisible.buttonC"><el-button size="medium"  v-if="excelTemplate.operVisible.buttonC==undefined || excelTemplate.operVisible.buttonC" @click="excelTemplate_createTemplate()" :disabled="excelTemplate.operDisabled.buttonC"  type="text"     native-type="button">生成模板</el-button>
</el-form-item>
<el-form-item v-if="excelTemplate.operVisible.export==undefined || excelTemplate.operVisible.export"><el-button size="medium"  v-if="excelTemplate.operVisible.export==undefined || excelTemplate.operVisible.export" @click="excelTemplate_export()" :disabled="excelTemplate.operDisabled.export"  type="text"     native-type="button">导出配置</el-button>
</el-form-item>
<el-form-item v-if="excelTemplate.operVisible.import==undefined || excelTemplate.operVisible.import"><el-upload
  action="platform/excelTemplate/import"
  :show-file-list="false"
  :data={}
   accept=".json"
  :disabled="excelTemplate.operDisabled.import"
  :http-request="excelTemplate_httpRequest">
  <el-button slot="trigger" size="medium" type="text" :disabled="excelTemplate.operDisabled.import" >导入配置</el-button>
</el-upload>
</el-form-item>

</el-form>
</div>
    <div></div>
</div>
<div class="ac-table-content">
    <el-table row-key="id" highlight-current-row stripe show-header border  
    :data="excelTemplate.data" size="mini" ref="excelTemplate"
       
    height="100%"
    @current-change="excelTemplate_currentChange">
    <el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="code" label="模板编码"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.code}}
   </template>
</el-table-column>
<el-table-column prop="label" label="模板名称"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.label}}
   </template>
</el-table-column>
<el-table-column prop="mainTable" label="关联主表"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.mainTable}}
   </template>
</el-table-column>
<el-table-column prop="remark" label="描述"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.remark}}
   </template>
</el-table-column>
<el-table-column prop="titleNo" label="标题行号"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.titleNo}}
   </template>
</el-table-column>

</el-table>

</div>
          
</div>
<div class="move"></div>
<div class="downBox " style="height:calc(100% - 302px);">
<el-tabs type="border-card" v-model="page.tabs" class=""  >
<el-tab-pane class="" label="模板元素" name="tab1" :disabled="tabDisabled.tab1" v-if="tabVisible.tab1" >
<div class="flex ac-table-head">
    <div class="ac-table-oper"><el-button size="medium"  v-if="excelTemplateField.operVisible.buttonA==undefined || excelTemplateField.operVisible.buttonA" @click="excelTemplateField_openExcelTempFieldAdd()" :disabled="excelTemplateField.operDisabled.buttonA"  type="text"     native-type="button">添加(A)</el-button>
<el-button size="medium"  v-if="excelTemplateField.operVisible.buttonD==undefined || excelTemplateField.operVisible.buttonD" @click="excelTemplateField_delete()" :disabled="excelTemplateField.operDisabled.buttonD"  type="text"     native-type="button">删除(D)</el-button>
<el-button size="medium"  v-if="excelTemplateField.operVisible.buttonE==undefined || excelTemplateField.operVisible.buttonE" @click="excelTemplateField_editExcelTempFieldAdd()" :disabled="excelTemplateField.operDisabled.buttonE"  type="text"     native-type="button">编辑(E)</el-button>
<el-button size="medium"  v-if="excelTemplateField.operVisible.buttonQ==undefined || excelTemplateField.operVisible.buttonQ" @click="excelTemplateField_load()" :disabled="excelTemplateField.operDisabled.buttonQ"  type="text"     native-type="button">刷新(Q)</el-button>
</div>
    <div></div>
</div>
<div class="ac-table-content">
    <el-table row-key="id" highlight-current-row stripe show-header border  
    :data="excelTemplateField.data" size="mini" ref="excelTemplateField"
       
    height="100%"
    @current-change="excelTemplateField_currentChange">
    <el-table-column prop="sortNo" label="序号" width="70"   align="center" sortable  class-name="editorCell">
   <template slot-scope="scope">
        <el-input-number size="small" v-model="scope.row.sortNo"       :controls="false"  @change="excelTemplateField_change('sortNo',scope.row)"></el-input-number>

   </template>
</el-table-column>
<el-table-column prop="label" label="列名称"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.label}}
   </template>
</el-table-column>
<el-table-column prop="dataType" label="数据类型" width="100"   align="left"   >
   <template slot-scope="scope">
        <template v-if="scope.row.dataType=='text'">字符文本</template><template v-else-if="scope.row.dataType=='number'">数值型</template><template v-else-if="scope.row.dataType=='datetime'">日期时间</template><template v-else-if="scope.row.dataType=='email'">邮箱</template><template v-else-if="scope.row.dataType=='phone'">手机号</template><template v-else-if="scope.row.dataType=='idcard'">身份证号码</template><template v-else-if="scope.row.dataType=='dict'">数据字典</template><template v-else>{{scope.row.dataType}}</template>
   </template>
</el-table-column>
<el-table-column prop="width" label="列宽" width="120"   align="left"   class-name="editorCell">
   <template slot-scope="scope">
        <el-input-number size="small" v-model="scope.row.width" :min="5"  :precision="0" :step="5"   :controls="false"  @change="excelTemplateField_change('width',scope.row)"></el-input-number>

   </template>
</el-table-column>
<el-table-column prop="isRequired" label="必填" width="70"   align="center"   class-name="editorCell">
   <template slot-scope="scope">
        <el-checkbox  v-model="scope.row.isRequired"  size="small"  true-label="Y"  false-label="N"  @change="excelTemplateField_change('isRequired',scope.row)"></el-checkbox>

   </template>
</el-table-column>
<el-table-column prop="tableName" label="关联表"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.tableName}}
   </template>
</el-table-column>
<el-table-column prop="columnName" label="关联字段"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.columnName}}
   </template>
</el-table-column>
<el-table-column prop="format" label="日期格式" width="160"   align="left"   >
   <template slot-scope="scope">
        {{scope.row.format}}
   </template>
</el-table-column>
<el-table-column prop="remark" label="备注"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.remark}}
   </template>
</el-table-column>
<el-table-column prop="columnAlias" label="字段别名"    align="left"   class-name="editorCell">
   <template slot-scope="scope">
        <el-input size="mini" type="text" v-model="scope.row.columnAlias"  @change="excelTemplateField_change('columnAlias',scope.row)"></el-input>

   </template>
</el-table-column>
<el-table-column prop="dictCode" label="字典代码"    align="left"   class-name="editorCell">
   <template slot-scope="scope">
        <el-input size="mini" type="text" v-model="scope.row.dictCode"  @change="excelTemplateField_change('dictCode',scope.row)"></el-input>

   </template>
</el-table-column>

</el-table>

</div>
          
</el-tab-pane>

</el-tabs>

</div>

<el-dialog :visible.sync="excelTemplateAdd.visible" :title="excelTemplateAdd.title"
            width="50%"
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""    label-width="80px" label-position="right"
     size="mini" ref="excelTemplateAdd" :model="excelTemplateAdd.data" :rules="excelTemplateAdd.rules"  
     :disabled="excelTemplateAdd.disabled" @submit.native.prevent>
    <el-row><el-col :span=24 v-if="excelTemplateAdd.itemVisible.code==undefined || excelTemplateAdd.itemVisible.code">
    <el-form-item prop="code" label="模板编码">
        
<el-input type="text" size="mini"  v-model="excelTemplateAdd.data.code" placeholder="模板编码" :disabled="excelTemplateAdd.editorForm || excelTemplateAdd.itemDisabled.code"  @keyup.enter.native="excelTemplateAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTemplateAdd.itemVisible.label==undefined || excelTemplateAdd.itemVisible.label">
    <el-form-item prop="label" label="模板名称">
        
<el-input type="text" size="mini"  v-model="excelTemplateAdd.data.label" placeholder="模板名称" :disabled="excelTemplateAdd.itemDisabled.label"  @keyup.enter.native="excelTemplateAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTemplateAdd.itemVisible.mainTable==undefined || excelTemplateAdd.itemVisible.mainTable">
    <el-form-item prop="mainTable" label="关联主表">
        <el-select v-model="excelTemplateAdd.data.mainTable"  placeholder="请选择" size="mini" :disabled="excelTemplateAdd.editorForm || excelTemplateAdd.itemDisabled.mainTable" clearable   filterable default-first-option  @keyup.enter.native="excelTemplateAdd_dialogOk">
   <el-option v-for="dict in customOptions.fkTable" :label="dict.label" :value="dict.value"></el-option>
</el-select>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTemplateAdd.itemVisible.titleNo==undefined || excelTemplateAdd.itemVisible.titleNo">
    <el-form-item prop="titleNo" label="标题行">
        <el-input-number size="mini" v-model="excelTemplateAdd.data.titleNo"  :disabled="excelTemplateAdd.itemDisabled.titleNo" :min="1" :max="4" :precision="0" :step="1"   :controls="false" ></el-input-number>

        <span class="ac-form-item-remark">excel行号从1开始</span>
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTemplateAdd.itemVisible.remark==undefined || excelTemplateAdd.itemVisible.remark">
    <el-form-item prop="remark" label="描述">
        
<el-input type="text" size="mini"  v-model="excelTemplateAdd.data.remark" placeholder="描述" :disabled="excelTemplateAdd.itemDisabled.remark"  @keyup.enter.native="excelTemplateAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="excelTemplateAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="excelTemplateAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="excelTempFieldAdd.visible" :title="excelTempFieldAdd.title"
            width="50%"
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""    label-width="80px" label-position="right"
     size="mini" ref="excelTempFieldAdd" :model="excelTempFieldAdd.data" :rules="excelTempFieldAdd.rules"  
     :disabled="excelTempFieldAdd.disabled" @submit.native.prevent>
    <el-row><el-col :span=24 v-if="excelTempFieldAdd.itemVisible.label==undefined || excelTempFieldAdd.itemVisible.label">
    <el-form-item prop="label" label="列名称">
        
<el-input type="text" size="mini"  v-model="excelTempFieldAdd.data.label" placeholder="列名称" :disabled="excelTempFieldAdd.itemDisabled.label"  @keyup.enter.native="excelTempFieldAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTempFieldAdd.itemVisible.tableName==undefined || excelTempFieldAdd.itemVisible.tableName">
    <el-form-item prop="tableName" label="关联表">
        <el-select v-model="excelTempFieldAdd.data.tableName"  placeholder="请选择" size="mini" :disabled="excelTempFieldAdd.itemDisabled.tableName" clearable   filterable default-first-option  @keyup.enter.native="excelTempFieldAdd_dialogOk">
   <el-option v-for="dict in customOptions.fkTable" :label="dict.label" :value="dict.value"></el-option>
</el-select>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTempFieldAdd.itemVisible.columnName==undefined || excelTempFieldAdd.itemVisible.columnName">
    <el-form-item prop="columnName" label="关联字段">
        <el-select v-model="excelTempFieldAdd.data.columnName"  placeholder="请选择" size="mini" :disabled="excelTempFieldAdd.itemDisabled.columnName" clearable  allow-create filterable default-first-option  @keyup.enter.native="excelTempFieldAdd_dialogOk">
   <el-option v-for="dict in customOptions.tableFields" :label="dict.label" :value="dict.value"></el-option>
</el-select>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTempFieldAdd.itemVisible.dataType==undefined || excelTempFieldAdd.itemVisible.dataType">
    <el-form-item prop="dataType" label="数据类型">
        <el-select v-model="excelTempFieldAdd.data.dataType"  placeholder="请选择" size="mini" :disabled="excelTempFieldAdd.itemDisabled.dataType" clearable      @keyup.enter.native="excelTempFieldAdd_dialogOk">
   <el-option label="字符文本" value="text"></el-option><el-option label="数值型" value="number"></el-option><el-option label="日期时间" value="datetime"></el-option><el-option label="邮箱" value="email"></el-option><el-option label="手机号" value="phone"></el-option><el-option label="身份证号码" value="idcard"></el-option><el-option label="数据字典" value="dict"></el-option>
</el-select>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTempFieldAdd.itemVisible.format==undefined || excelTempFieldAdd.itemVisible.format">
    <el-form-item prop="format" label="日期格式">
        
<el-input type="text" size="mini"  v-model="excelTempFieldAdd.data.format" placeholder="日期格式" :disabled="excelTempFieldAdd.itemDisabled.format"  @keyup.enter.native="excelTempFieldAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="excelTempFieldAdd.itemVisible.remark==undefined || excelTempFieldAdd.itemVisible.remark">
    <el-form-item prop="remark" label="备注">
        
<el-input type="text" size="mini"  v-model="excelTempFieldAdd.data.remark" placeholder="备注" :disabled="excelTempFieldAdd.itemDisabled.remark"  @keyup.enter.native="excelTempFieldAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="excelTempFieldAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="excelTempFieldAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>


</div>

</body>
<script th:inline="javascript">
    let vm = new Vue({
            el: '#app',
            data() {
                return {"excelTemplate":{"title":"excel模板","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{},"operData":{},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"excelTemplateField":{"title":"模板元素","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{},"operData":{},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"page":{"tabs":"tab1"},"tabDisabled":{"tab1":false},"tabVisible":{"tab1":true},"customOptions":{},"dictOptions":{},"excelTemplateAdd":{"visible":false,"title":"添加模板","data":{"titleNo":1},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"code":[{"required":true,"message":"请输入模板编码","trigger":"blur"}],"label":[{"required":true,"message":"请输入模板名称","trigger":"blur"}],"mainTable":[{"required":true,"message":"请输入关联主表","trigger":"blur"}],"titleNo":[{"required":true,"message":"请输入标题行","trigger":"blur"}]}},"excelTempFieldAdd":{"visible":false,"title":"添加模板元素","data":{"dataType":"text"},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{},"itemDisabled":{},"transfer":{},"rules":{"label":[{"required":true,"message":"请输入列名称","trigger":"blur"}],"tableName":[{"required":true,"message":"请输入关联表","trigger":"blur"}],"dataType":[{"required":true,"message":"请输入数据类型","trigger":"blur"}]}}}
            },
            watch: {
"excelTempFieldAdd.data.tableName":function(newVal, oldVal) {
    let that = this;
    HttpApi.customOptions("tableFields", {
        "tableName": newVal
    }, function(res) {
        that.$set(that.customOptions, "tableFields", res);
    })

}},
            methods: {
excelTemplate_editExcelTemplateAdd:function() {
    let that = this;
    this.excelTemplateAdd.editorForm = true;
    if (!this.excelTemplate.currentRow.id) {
        this.$alert("请先选中一条excel模板信息");
        return;
    } else {
        this.excelTemplateAdd_dialogOpen(this.excelTemplate.currentRow, function(dialogData) {
            HttpApi.saveProvider("sysExcelTemplate", dialogData, function(res) {
                let index = that.excelTemplate.data.findIndex(function(item) {
                    return item.id == res.id;
                });
                that.$set(that.excelTemplate.data, index, res);
                that.excelTemplateAdd.visible = false;
            });
        })
    }
},
excelTemplateField_load:function() {
    let that = this;
    HttpApi.queryArray("sysExcelTemplateField", that.excelTemplateField.operData, function(res) {
        that.excelTemplateField.data = res;

        if (that.excelTemplateField.data.length > 0) {
            that.$refs.excelTemplateField.setCurrentRow(that.excelTemplateField.data[0]);
        }

    });
},
excelTemplateAdd_dialogOpen:function(param, callback) {
    let that = this;
    this.$data.excelTemplateAdd.data = this.$options.data().excelTemplateAdd.data;
    this.$data.excelTemplateAdd.operData = this.$options.data().excelTemplateAdd.operData;
    for (let val in param) {
        this.$set(this.excelTemplateAdd.data, val, param[val])
    }

    this.excelTemplateAdd.callback = callback;
    this.excelTemplateAdd.visible = true;
},
excelTemplate_createTemplate:function(param) {
    let that = this;
    let code = this.excelTemplate.currentRow.code;
    if (!code || code == '') {
        this.$alert("请选择一条要操作的数据！");
        return;
    }

    HttpApi.download("/platform/excelTemplate/createTemplate", {
        "templateCode": code
    });

},
excelTemplateField_editExcelTempFieldAdd:function(){
    let that = this;
    this.excelTempFieldAdd.editorForm = true;
    if(!this.excelTemplateField.currentRow.id){
        this.$alert("请先选中一条模板元素信息");
        return;
    }else{
        this.excelTempFieldAdd_dialogOpen(this.excelTemplateField.currentRow,function(dialogData){
            HttpApi.saveProvider("sysExcelTemplateField",dialogData,function(res){
                let index = that.excelTemplateField.data.findIndex(function(item){
                    return item.id==res.id;
                });
                that.$set(that.excelTemplateField.data, index, res);
                that.$refs.excelTemplateField.setCurrentRow(res);
                that.excelTempFieldAdd.visible = false;
            });
        })
    }
},
excelTemplate_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       this.$set(this.excelTemplate.operDisabled, "buttonD", true);//删除(D)
this.$set(this.excelTemplate.operDisabled, "buttonE", true);//编辑(E)
this.$set(this.excelTemplate.operDisabled, "type", true);//上传模板
this.$set(this.excelTemplate.operDisabled, "buttonC", true);//生成模板

    }else {
       this.$set(this.excelTemplate.operDisabled, "buttonD", false);//删除(D)
this.$set(this.excelTemplate.operDisabled, "buttonE", false);//编辑(E)
this.$set(this.excelTemplate.operDisabled, "type", false);//上传模板
this.$set(this.excelTemplate.operDisabled, "buttonC", false);//生成模板

    }
},
excelTemplate_currentChange:function(currentRow){
    if(currentRow){
        this.excelTemplate.currentNodeKey=currentRow.id;
        this.excelTemplate.currentRow = currentRow;
            this.excelTemplateField.operData.templateCode=this.excelTemplate.currentRow.code;
this.excelTemplateField_load();

    }else{
        this.$data.excelTemplate.currentNodeKey=this.$options.data().excelTemplate.currentNodeKey;
        this.$data.excelTemplate.currentRow = this.$options.data().excelTemplate.currentRow;
        this.$data.excelTemplateField.operData=this.$options.data().excelTemplateField.operData;
this.$data.excelTemplateField.data=this.$options.data().excelTemplateField.data;

    }
    this.excelTemplate_operCtrl(currentRow);
},
excelTemplate_load:function(){
    let that = this;
    HttpApi.queryArray("sysExcelTemplate",this.excelTemplate.operData,function(res){
        that.excelTemplate.data  = res;
        if(that.excelTemplate.data.length>0){
            that.$refs.excelTemplate.setCurrentRow(that.excelTemplate.data[0]);
            that.excelTemplate_operCtrl(that.excelTemplate.data[0]);
        }else{
             that.$refs.excelTemplate.setCurrentRow();
             that.excelTemplate_operCtrl();
        }
    });
},
excelTemplate_export:function() {
    let that = this;
    let selection = that.$refs.excelTemplate.selection;
    let selLength = selection.length;
    if (selLength == 0) {
        that.$alert("请勾选要操作的数据");
        return;
    }

    HttpApi.download("/platform/excelTemplate/export", selection, function(res) {

    });
},
excelTemplateField_change:function(fieldName, row) {
    HttpApi.updateProvider("sysExcelTemplateField", fieldName, row, function() {

    });
},
excelTemplateAdd_dialogCancel:function(){
     this.excelTemplateAdd.visible = false;
},
excelTemplateField_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.stdSolReceiveHistory.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.stdSolReceiveHistory.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       this.$set(this.excelTemplateField.operDisabled, "buttonD", true);//删除(D)
this.$set(this.excelTemplateField.operDisabled, "buttonE", true);//编辑(E)

    }else {
       this.$set(this.excelTemplateField.operDisabled, "buttonD", false);//删除(D)
this.$set(this.excelTemplateField.operDisabled, "buttonE", false);//编辑(E)

    }
},
excelTemplateField_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.excelTemplateField.currentRow = this.$options.data().excelTemplateField.currentRow;
    }else{
        this.excelTemplateField.currentRow = currentRow;
    }
},
excelTemplateField_openExcelTempFieldAdd:function(){
    let that = this;
    if (!this.excelTemplate.currentRow.id) {
        this.$alert("请先选中一条excel模板信息");
        return;
    }else{
        this.excelTempFieldAdd.editorForm = false;
        let param = {};
        param.templateCode=this.excelTemplateField.operData.templateCode;

        this.excelTempFieldAdd_dialogOpen(param,function(dialogData){
            HttpApi.saveProvider("sysExcelTemplateField",dialogData,function(res){
                that.$message.success("操作成功！");
                that.excelTemplateField.data.push(res);
                that.$refs.excelTemplateField.setCurrentRow(res);
                that.excelTempFieldAdd.visible = false;
            });
        })
    
    }
},
excelTemplate_openExcelTemplateAdd:function() {
    let that = this;
    this.excelTemplateAdd.editorForm = false;
    let param = {};

    this.excelTemplateAdd_dialogOpen(param, function(dialogData) {
        HttpApi.post("/platform/excelTemplate/save", dialogData, function(res) {
            that.excelTemplate.data.push(res);
            that.$refs.excelTemplate.setCurrentRow(res);
            that.excelTemplateAdd.visible = false;
        });
    })
},
excelTempFieldAdd_dialogOk:function(){
      let that = this;
      this.$refs.excelTempFieldAdd.validate(function(valid){
           if(valid){
                that.excelTempFieldAdd.callback(that.excelTempFieldAdd.data);
           }else{
                return false;
           }
      });
},
excelTemplateField_delete:function() {
    let that = this;
    let id = this.excelTemplateField.currentRow.id;
    if (id) {
        HttpApi.delProviderConfirm("sysExcelTemplateField", this.excelTemplateField.currentRow, function(res) {
            let index = that.excelTemplateField.data.findIndex(function(item) {
                return item.id == id;
            });
            that.excelTemplateField.data.splice(index, 1);
            if (that.excelTemplateField.data.length == 0) {
                that.$data.excelTemplateField.currentRow = that.$options.data().excelTemplateField.currentRow;
                that.$refs.excelTemplateField.setCurrentRow();
            } else if (that.excelTemplateField.data.length > index) {
                that.$refs.excelTemplateField.setCurrentRow(that.excelTemplateField.data[index]);
            } else {
                that.$refs.excelTemplateField.setCurrentRow(that.excelTemplateField.data[index - 1]);
            }
            that.$message.success("删除成功");
        });
    } else {
        that.$alert("请选择要删除的数据");
    }
},
excelTemplateAdd_dialogOk:function(){
      let that = this;
      this.$refs.excelTemplateAdd.validate(function(valid){
           if(valid){
                that.excelTemplateAdd.callback(that.excelTemplateAdd.data);
           }else{
                return false;
           }
      });
},
excelTemplate_delete:function() {
    let that = this;
    let selection = that.$refs.excelTemplate.selection;
    let selLength = selection.length;
    if (selLength == 0) {
        that.$alert("请勾选要操作的数据");
        return;
    }
    HttpApi.delBatchProviderConfirm("sysExcelTemplate", selection, function(res) {
        for (let i = 0; i < selLength; i++) {
            let index = that.excelTemplate.data.findIndex(function(item) {
                return item.id == selection[i].id;
            });
            that.excelTemplate.data.splice(index, 1);
        }

        if (that.excelTemplate.data.length == 0) {
            that.$data.excelTemplate.currentRow = that.$options.data().excelTemplate.currentRow;
            that.$refs.excelTemplate.setCurrentRow();
        } else {
            that.$refs.excelTemplate.setCurrentRow(that.excelTemplate.data[0]);
        }
        that.$message.success("删除成功");
    });
},
excelTempFieldAdd_dialogCancel:function(){
     this.excelTempFieldAdd.visible = false;
},
excelTempFieldAdd_dialogOpen:function(param,callback){
    this.$data.excelTempFieldAdd.data = this.$options.data().excelTempFieldAdd.data;
    this.$data.excelTempFieldAdd.operData = this.$options.data().excelTempFieldAdd.operData;
    for(let val in param) {
        this.$set(this.excelTempFieldAdd.data, val, param[val])
    }
    this.excelTempFieldAdd.callback=callback;
    this.excelTempFieldAdd.visible = true;
}
,
excelTempFieldAdd_load:function() {
    let that = this;
    HttpApi.queryObject("sysExcelTemplateField", this.excelTempFieldAdd.operData, function(res) {
        that.excelTempFieldAdd.data = res;
    });
},
excelTemplate_httpRequest:function(file) {
    let that = this;
    let fileData = file.data;
    HttpApi.upload(file, function(fileAttr) {
        that.excelTemplate_load();
    })
},
excelTemplateAdd_load:function() {
    let that = this;
    HttpApi.queryObject("sysExcelTemplate", this.excelTemplateAdd.operData, function(res) {
        that.excelTemplateAdd.data = res;
    });
},
excelTemplate_change:function(fieldName, row) {
    HttpApi.updateProvider("sysExcelTemplate", fieldName, row, function() {

    });
}
},
            mounted: function(){
    dragControllerLR();
    dragControllerUD();
},
            created: function(){
    let that=this;
    //获取字典信息
    HttpApi.dictOptions([],function(res){
        that.dictOptions=res;
    });

    //加载自定义数据字典
    HttpApi.customOptions("fkTable",{},function(res){
    that.$set(that.customOptions, "fkTable", res);
});
HttpApi.customOptions("tableFields",{},function(res){
    that.$set(that.customOptions, "tableFields", res);
});


    //加载初始化load
    this.excelTemplate_load();


    //加载初始化方法
    
}
    });
    

    
</script>
</html>
